package ssssscala.dataframe

import org.apache.spark.sql.SQLContext
import org.apache.spark.{SparkConf, SparkContext}

/**
  * Auther: Mengkunxuan
  * Date:2018 /9/2510:24
  * Description:
  */
object DataFrameOperation {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setAppName("DataFrameCreate").setMaster("local");
    val sc =new SparkContext(conf)
    val sqlContext = new SQLContext(sc)
    val df = sqlContext.read.json("f://")
    df.show()
    df.printSchema()
    df.select(df("name"),df("age")+1).show()
    df.filter( df("age")>18).show()
    df.groupBy("age").count().show()
  }
}
